#!/usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'baixue'

ErrorMsg = ("Fail to Get Error Message",
            "Invalid Error Code",
            "Configuration data lost")


class Adk_Error(Exception):
    def __init__(self, errcode):
        self.errorcode = errcode

    def __str__(self):
        DRV_GetErrorMessage(self.errorcode, ErrorMsg_)
        if ErrorMsg_ in (1, 2, 3):
            return ErrorMsg[ErrorMsg_]
        else:return ErrorMsg_


def check_return(errorcode):
    if errorcode != 0:
        raise Ads_Error(errorcode)
    else:pass
